package cn.doit.scala.day01.block

/**
 * @DATE 2021/12/24/14:09
 * @Author MDK
 * @Version 2021.2.2
 * */
object C02_For08 {
  def main(args: Array[String]): Unit = {
    val arr = Array[Int](57, 16, 18, 5, 9, 34, 67)
    //守卫模式过滤偶数  推导式收集结果数据
    val res : Array[String] = for (elem <- arr if elem%2 == 0) yield{
      val i: Int = elem * 10
//      elem
      "hello"+ i
    }
    //将数组转化为list 重写了toString方法
    println(res.toList)
    val res2 : Array[Int] = for (elem <- arr) yield elem *10
    for (elem <- res2) {
      println(elem)
    }
  }
}
